﻿#ifndef DACONSTVALUENODEGRAPHICSITEM_H
#define DACONSTVALUENODEGRAPHICSITEM_H
#include "DAUtilNodePluginGlobal.h"
#include "DAStandardNodeGraphicsItem.h"
#include "DAVariantValueNode.h"

/**
 * @brief 变量及常数节点，此节点存放常数
 */
class DAUTILNODEPLUGIN_API DAVariantValueNodeGraphicsItem : public DAStandardNodeGraphicsItem
{
public:
    DAVariantValueNodeGraphicsItem(std::shared_ptr<DAVariantValueNode> n, QGraphicsItem *p = nullptr);
    DAVariantValueNodeGraphicsItem(DAAbstractNode::SharedPointer n, QGraphicsItem *p = nullptr);
    ~DAVariantValueNodeGraphicsItem();

    //外部参数
    //设置参数，如果无法设置成功返回false
    bool setValue(const QVariant &v);

    //获取数据
    QVariant getValue() const;

    //判断数据是否为空
    bool isNull() const;

protected:
    bool checkType() const;

private:
    void init();

private:
    QVariant m_value;
    QList<DANodeLinkPoint> m_linkPoints;
};

#endif // FCCONSTVALUENODEGRAPHICSITEM_H
